<?php
namespace frontend\comp;

use yii\base\Component;
use yii\base\Exception;

class UserInfo extends Component{
    public $userid;
    public $qcode;

//    public function __construct()
//    {
//        $userid = \Yii::$app->session->get('userid');
//        if(!$userid){
//            $post = \Yii::$app->request->post();
//            $userid = isset($post['userid'])?$post['userid']:'';
//            if(!$userid) {
//                throw new  Exception('userid找不到');
//            }
//        }
//        $this->userid = $userid;
//    }
    public function __construct()
    {
        $userid = \Yii::$app->session->get('userid');
        $qcode = \Yii::$app->session->get('qcode');
        if(!$userid){
//            $this->userid = '5ed7d4c0-f9bc-11e7-b4fe-ed511e67bf06';
//            $this->userid = 'd827ec50-f9bc-11e7-835b-af5f1e65266f';
//            $this->userid = '5ed7d4c0-f9bc-11e7-b4fe-ed511e67bf06';
            $this->userid = '4b7857e0-3bdb-11e8-8f5a-0f984f2886db';
            return;
//            print_r('系统错误请稍后再试');exit;
            return;
        }
        if(!$qcode){
            $this->qcode = '0';
        }
        $this->qcode = $qcode;
        $this->userid = $userid;
    }
}